package ui

import androidx.compose.desktop.ui.tooling.preview.Preview
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.AccountCircle
import androidx.compose.runtime.*
import kotlinx.coroutines.launch

@Composable
@Preview
fun App() {
    var text by remember { mutableStateOf("Hello, World!") }
    val scaffoldState = rememberScaffoldState()
    val scope = rememberCoroutineScope()

    MaterialTheme {
        Scaffold(topBar = {
            TopAppBar(
                title = { Text(text = "Compose controls gallery") },
                navigationIcon = { Icon(Icons.Default.AccountCircle, null) })

        }, drawerContent = {
            Text("这是侧边栏么？")
        },
            scaffoldState = scaffoldState, floatingActionButton = {
                ExtendedFloatingActionButton(text = { Text("打开或关闭抽屉") }, onClick = {
                    scope.launch { scaffoldState.drawerState.apply { if (isClosed) open() else close() } }
                })
            }) {
            Surface(color = MaterialTheme.colors.background) {
                Button(onClick = {
                    text = "Hello, Desktop!"
                }) {
                    Text(text)
                }
            }
        }


    }
}